<template>
  <el-form ref="activityRefForm" :model="activityRemark" label-width="120px" :rules="activityRules">
    <el-form-item label="ID">
      <div class="detail">&nbsp;{{activityDetail.id}}</div>
    </el-form-item>

    <el-form-item label="负责人">
      <div class="detail">&nbsp;{{activityDetail.ownerDO.name}}</div>
    </el-form-item>

    <el-form-item label="活动名称">
      <div class="detail">&nbsp;{{activityDetail.name}}</div>
    </el-form-item>

    <el-form-item label="开始时间">
      <div class="detail">&nbsp;{{activityDetail.startTime}}</div>
    </el-form-item>

    <el-form-item label="结束时间">
      <div class="detail">&nbsp;{{activityDetail.endTime}}</div>
    </el-form-item>

    <el-form-item label="活动预算">
      <div class="detail">&nbsp;{{activityDetail.cost}}</div>
    </el-form-item>

    <el-form-item label="活动描述">
      <div class="detail">&nbsp;{{activityDetail.description}}</div>
    </el-form-item>

    <el-form-item label="创建时间">
      <div class="detail">&nbsp;{{activityDetail.createTime}}</div>
    </el-form-item>

    <el-form-item label="创建人">
      <div class="detail">&nbsp;{{activityDetail.createByDO.name}}</div>
    </el-form-item>

    <el-form-item label="修改时间">
    <div class="detail">&nbsp;{{activityDetail.editTime}}</div>
    </el-form-item>

    <el-form-item label="修改人">
      <div class="detail">&nbsp;{{activityDetail.editByDO.name}}</div>
    </el-form-item>
  </el-form>
</template>

<script>
import {doGet,} from "../http/httpRequest.js";
import {back} from "../utils/util.js";

export default {
  inject: ['reload'],
  name: "ActivityDetailView",
  data(){
    return {
      activityDetail: {
        ownerDO: {},
        createByDO: {},
        editByDO: {},
      },
      activityRemark: {},
      activityRemarkQuery: {},
      // 验证规则
      activityRules: {}
    }
  },
  // 页面渲染时加载
  mounted() {
    this.loadActivityDetail();
  },

  methods: {
    back,
    // 加载页面详情
    loadActivityDetail(){
      let id = this.$route.params.id;
      doGet('/api/activity/'+id,{}).then(resp=>{
        if (resp.data.code===200){
          this.activityDetail= resp.data.data;
          if (!this.activityDetail.ownerDO){
            this.activityDetail.ownerDO={}
          }
          if (!this.activityDetail.createByDO){
            this.activityDetail.createByDO={}
          }
          if (!this.activityDetail.editByDO){
            this.activityDetail.editByDO={}
          }
        }
      })
    },
  }
}
</script>
<style scoped>
.detail {
  background-color: #F0FFFF;
  width: 80%;
  padding-left: 5px;
}
.el-form-item {
  height: 30px;
}
</style>